﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class D02_Input : MonoBehaviour
{
    private void Update()
    {
        //获取鼠标案件输入
        if (Input.GetMouseButtonDown(0))
        {
            print("按下了鼠标左键");
        }
        //获取键盘按键输入
        if (Input.GetKeyDown(KeyCode.A)) //是否按下A
        {
            print("按下了A键");
        }
        //获取虚拟案件
        if (Input.GetButtonDown("Fire1"))
        {
            print("按下开火1");
        }
        //获取虚拟轴    水平轴:AD    垂直轴:WS
        //float h = Input.GetAxisRaw("Horizontal"); //A:-1   D:1
        //float v = Input.GetAxisRaw("Vertical");//S:-1  W:1

        //获取鼠标滑动增量
        if (Input.GetMouseButton(1))
        {
            //鼠标水平滑动量
            float mouseX = Input.GetAxis("Mouse X");
            float mouseY = Input.GetAxis("Mouse Y");
            Debug.LogFormat("MouseX:{0}\tMouseY{1}", mouseX, 0);
        }
    }
}